<!DOCTYPE html>
<html lang="zh_CN">

<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>个人信息</title>
	<meta name="viewport" content="initial-scale=1, maximum-scale=1">
	<!-- <link rel="shortcut icon" href="http://favicon.ico"> -->
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="viewport"
		content="width=device-width, height=device-height, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">

	<!--<link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm-extend.min.css">-->

	<!-- 固定的css 和 common.js 的引用    -->
	<link rel="stylesheet" href="http://47.104.254.28/commonfile/css/sm.min.css">
	<link rel="stylesheet" href="http://47.104.254.28/commonfile/css/sm-extend.min.css">
	<link rel="stylesheet" href="http://47.104.254.28/commonfile/css/common.css">
	<script type="text/javascript" src="http://47.104.254.28/commonfile/common/common/common.js"></script>

	<!-- <script type="text/javascript" src="http://47.104.254.28/commonfile/js/js/vconsole.min.js"></script>
	<script>
		var vConsole = new VConsole();
	</script> -->

	<style type="text/css">
		/*css 的样式都放在这里*/
		.list-block {
			margin: 0 0;
		}

		#change {
			/*border: solid red 1px;*/
			z-index: 15;
			/*width: 100%;
 		height: 100%;*/
			position: absolute;
			top: 0;
			right: 0;
			bottom: 0;
			left: 0;
			overflow: auto;
			opacity: 1;
			background-color: white;

		}

		/*头像图片样式*/
		#img_div_content {
			padding-bottom: 0.7rem;
			padding-top: 0.7rem;
		}

		#img_div_content img {
			border: solid gray 1px;
			border-radius: 50%;
			height: 60px;
			width: 60px;
		}

		/*微信,手机号字体颜色*/
		#gerenxinxi_weixin,
		#gerenxinxi_qq,
		#gerenxinxi_sina {
			color: darkgray
		}

		/*第一个块和第二个块之间的间隙*/
		#segmentation {
			height: 5px;
		}

		/*退出登录样式*/
		#Logout {
			background-color: white;
			margin-top: 30px;
			text-align: center;
			padding-top: 15px;
			padding-bottom: 15px;
		}

		.item-content {
			padding-top: 5px;
			padding-bottom: 5px;

		}
	</style>


</head>

<body>
	<div class="page-group">
		<div class="page page-current">

			<!-- html代码内容区域 -->
			<div class="content">
				<div class="list-block">
					<ul>
						<li class="item-content">
							<div class="item-inner" id="img_div_content" onclick="chooseLocalImage()">
								<span id="">
									头像
								</span>
								<!--<img src="../img/zidingyi/eight.jpg"/>-->

							</div>
						</li>
						<li class="item-content item-link" onclick="change_nicheng()">
							<div class="item-inner">
								<div class="item-title">昵称</div>
								<div class="item-after" id="nickname"></div>
							</div>
						</li>
						<li class="item-content item-link" onclick="change_mobile()">
							<div class="item-inner">
								<div class="item-title">手机号</div>
								<div class="item-after" id="phone"></div>
							</div>
						</li>
						<li class="item-content item-link" onclick="change_password()">
							<div class="item-inner">
								<div class="item-title">修改密码</div>
							</div>
						</li>
						<li class="item-content">
							<div class="item-inner">
								<div class="item-title">所属分站</div>
								<div class="item-after" id="substation"></div>
							</div>
						</li>
					</ul>
					<div id="segmentation">

					</div>
					<ul>
						<!-- <li class="item-content item-link" onclick="change_weixin()">
							<div class="item-inner">
								<div class="item-title">微信</div>
								<div class="item-after" id="gerenxinxi_weixin">未绑定</div>
							</div>
						</li>
						<li class="item-content item-link" onclick="change_QQ()">
							<div class="item-inner">
								<div class="item-title">QQ</div>
								<div class="item-after" id="gerenxinxi_qq">未绑定</div>
							</div>
						</li>
						<li class="item-content item-link" onclick="change_sina()">
							<div class="item-inner">
								<div class="item-title">新浪微博</div>
								<div class="item-after" id="gerenxinxi_sina">未绑定</div>
							</div>
						</li> -->
						<li class="item-content item-link" onclick="clearcache()">
							<div class="item-inner">
								<div class="item-title">清除缓存</div>
							</div>
						</li>
					</ul>

					<div id="Logout" onclick="gerenxinxi_logout()">
						<div id="">
							<span id="">
								退出登录
							</span>
						</div>
					</div>

				</div>
			</div>


		</div>
	</div>





	<!-- 固定的js引用，所有的jQuery 要用 $$ 表示 -->
	<script type="text/javascript" src="http://47.104.254.28/commonfile/js/js/jquery-1.11.1.min.js"></script>
	<!-- 这一行代码是为了 避免js冲突 -->
	<script type="text/javascript">var $$ = jQuery.noConflict();</script>
	<script type='text/javascript' src='http://47.104.254.28/commonfile/zepto/zepto/zepto.min.js' charset='utf-8'></script>
	<script type='text/javascript' src='http://47.104.254.28/commonfile/js/js/sm.min.js' charset='utf-8'></script>
	<script type='text/javascript' src='http://47.104.254.28/commonfile/js/js/sm-extend.min.js' charset='utf-8'></script>


	<script type="text/javascript">

		var isqq_bind = 0;
		var iswechat_bind = 0;
		var issina_bind = 0;


		// 函数区域，函数放在“初始化区域的上面”
		//html页面 onclick 触发打开本地图库
		function chooseLocalImage() {
			//打开本地图库，或者选择图片上传
			native_chooseupimage('');
		}

		//	调取个人信息接口
		function getParams(data) {
			// data需要转成json调用 ，函数urlParamParseJson();
			//var jsonData = urlParamParseJson(data);
			var params = {
			};
			net_request('get', 'user/info', params, infosuccessCallBack, errorCallBack);
		}
		//	退出接口
		function gerenxinxi_logout() {
			var logout = {
				callbacktype: 'logout'
			};
			net_request('post', 'user/logout', logout, postsuccessCallBack, posterrorCallBack);
		}
		//	退出成功接口
		function postsuccessCallBack(data) {
			console.log(data);
			if (isNotNull(data)) {
				//        console.log(data);
				if (data.success == true) {
					if (isNotNull(data.callbacktype) && data.callbacktype == 'logout') {
						//  				成功回调退出到login
						native_goto('local/login');
					}

				}
			}

		}


		function clearcache() {
			native_showtoast("清除缓存成功");
		}

		//个人信息成功的回调函数
		function infosuccessCallBack(data) {
			// isNotNull() 用来判断字段不为空
			isqq_bind = 0;
			iswechat_bind = 0;
			issina_bind = 0;
			if (isNotNull(data)) {
				//        console.log(data);
				if (data.success == true) {
					//        console.log(data);
					var curval = data.data;
					//        console.log(curval);
					// isNotNull() 用来判断字段不为空
					if (isNotNull(curval.nickname)) {
						$$("#nickname").text(curval.nickname);
					}
					if (isNotNull(curval.avatar_url)) {
						var touxiang = '<span id="">头像</span><img src="' + curval.avatar_url + '"/>'
						$$("#img_div_content").html(touxiang);
					}
					if (isNotNull(curval.name)) {
						$$("#phone").text(curval.name);
					}
					if (isNotNull(curval.substation_name)) {
						$$("#substation").text(curval.substation_name);
					}

					
					// if (isNotNull(curval.wechat_id)) {
					// 	iswechat_bind = 1;
					// 	$$("#gerenxinxi_weixin").text("已绑定");
					// }
					// if (isNotNull(curval.qq_id)) {
					// 	isqq_bind = 1;
					// 	$$("#gerenxinxi_qq").text("已绑定");
					// }
					// if (isNotNull(curval.weibo_id)) {
					// 	issina_bind = 1;
					// 	$$("#gerenxinxi_sina").text("已绑定");
					// }
				}
			}
		}
		// 失败的回调函数
		function errorCallBack(data) {
			console.log(data);
		}
		//post失败的回调函数
		function posterrorCallBack(data) {
			console.log(data);
			if (isNotNull(data)) {
				if (isNotNull(data.callbacktype) && data.callbacktype == "logout") {
					//  		成功回调退出到login
					native_goto('local/login');
				}
			}
		}


		//	修改个人信息页的昵称
		function change_nicheng() {
			native_goto('local/gerenxinxi_xiugai_nicheng_shoujihao');
		}
		//	修改个人信息页的手机号
		function change_mobile() {
			native_goto('local/gerenxinxi_xiugai_nicheng_shoujihao');
		}
		//	修改个人信息页的密码
		function change_password() {
			native_goto('local/gerenxinxi_xiugai_nicheng_password');
		}
		//	修改个人信息页的绑定微信
		function change_weixin() {
			native_goto('local/gerenxinxi_xiugai_nicheng_weixin?state=' + iswechat_bind);
		}
		//	修改个人信息页的绑定QQ
		function change_QQ() {
			native_goto('local/gerenxinxi_xiugai_nicheng_QQ?state=' + isqq_bind);
		}

		//	修改个人信息页的绑定新浪微博
		function change_sina() {
			native_goto('local/gerenxinxi_xiugai_nicheng_sina?state=' + issina_bind);
		}


		// 初始化区域
		$$(function () {

			// getParams("getParams?id="+curuserid);
			// getParams();
			$.init();
		});


	</script>
</body>

</html>